#include <stdio.h>
int main()
{
	int a,b,i,sum1=0,sum2=0;
	scanf("%d %d",&a,&b);
	printf("%d,",a);
	for(i=a/2;i>1;i--)
	{
		if(a%i==0)
		{
			sum1+=i;
			printf("%d+",i);
		}
	}
	sum1+=1;
	printf("1=%d\n",sum1);
	printf("%d,",b);
	for(i=b/2;i>1;i--)
	{
		if(b%i==0)
		{
			sum2+=i;
			printf("%d+",i);
		}
	}
	sum2+=1;
	printf("1=%d\n",sum2);
	if(sum1=b && sum2==a)
	{
		printf("1\n");
	}else{
		printf("0\n");
	}
	return 0;
}